from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class TestCase1:
    def __init__(self):
        # 获取邮箱网址
        self.driver = webdriver.Chrome()
        self.driver.get('https://mail.qq.com/')

    def register(self):
        # 跳转登录的frame页面
        self.driver.switch_to.frame('login_frame')

        # 登录
        u = self.driver.find_element(By.ID, 'u')
        u.send_keys('16329@qq.com')

        passwd = self.driver.find_element(By.ID, 'p')
        passwd.send_keys('mm12345')

        time.sleep(3)
        self.driver.find_element(By.ID, 'login_button').click()

    def quit(self):
        #退出浏览器
        time.sleep(2)
        self.driver.quit()


if __name__ == '__main__':
    qqEmail = TestCase1()
    qqEmail.register()
    qqEmail.quit()
